package com.com.effectivejava.generics.example4;

import com.com.effectivejava.generics.util.Child;
import com.com.effectivejava.generics.util.GrandChild;
import com.com.effectivejava.generics.util.GrandParent;
import com.com.effectivejava.generics.util.Parent;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by User on 27/07/2015.
 */
public class Example
{
    public static void main(String[] args) {

        //List<Object> objects =  new ArrayList<GrandParent>();
        //List<GrandParent> objects =  new ArrayList<Parent>();
        //List<Number> numbers = new ArrayList<Integer>();

        List<GrandParent> grandParents =  new ArrayList<GrandParent>();
        grandParents.add(new Parent());
        grandParents.add(new Child());
        grandParents.add(new GrandChild());

        List<? extends GrandParent> gp = new ArrayList<Parent>();
        gp.add(null);

        List<Number> numbers = new ArrayList<Number>();
        numbers.add(1);
        numbers.add(3.14);

        List<? extends Number> number = new ArrayList<Number>();
        List<? extends Number> integers = new ArrayList<Integer>();
        List<? extends Number> doubles = new ArrayList<Double>();



        List<? super Integer> in =  new ArrayList<Integer>();
        in = numbers;
        in.add(1);



        List<? super Integer> num =  new ArrayList<Number>();
        List<? super Integer> objects =  new ArrayList<Object>();






















    }
}
